#!/usr/bin/env python

import cx_Oracle
import pepe.p_sql.oracle_system as osp
import getpass

default = raw_input("Connect to dtrslab3 (y/n): ")

if default in ('Y', 'y'):
    ip = '127.0.0.1'    # tunneled to remote server or local connection
    sid = 'dtrslab3'
else:
    ip = raw_input("IP: ")
    sid = raw_input("Sid: ")

#port = 1522         # shifted to tunneled 1522, on 1521 is local XE instance
#port = 1521
port = raw_input("Port: ")

dsn_tns = cx_Oracle.makedsn(ip, port, sid)

#usr = 'vpresovsky'
usr = raw_input("Input username: ")

#pwd = '...'
pwd = getpass.getpass()

conString = {'usr': usr, 'pwd': pwd, 'dsn': dsn_tns}
osp.list_columns(conString)